﻿@model ProductPriceModel

@using Nop.Core
@using Nop.Core.Domain.Tax

@inject IWorkContext workContext

@if (!Model.CustomerEntersPrice)
{
    <div class="prices">
        @if (Model.CallForPrice)
        {
            @*call for price*@
            <div class="product-price call-for-price">
                <span>@T("Products.CallForPrice")</span>
            </div>
        }
        else
        {
            if (Model.IsRental)
            {
                <div class="rental-price">
                    <span>@T("Products.Price.RentalPrice"):</span>
                    <span>@Model.RentalPrice</span>
                </div>
            }
            if (!string.IsNullOrWhiteSpace(Model.OldPrice))
            {
                @*old price*@
                <div class="old-product-price">
                    <span>@T("Products.Price.OldPrice"):</span>
                    <span>@Model.OldPrice</span>
                </div>
            }
            <div class="@if (string.IsNullOrWhiteSpace(Model.PriceWithDiscount))
                        {
                            <text>product-price</text>
                        }
                        else
                        {
                            <text>non-discounted-price</text>
                        }">
                @if (!string.IsNullOrWhiteSpace(Model.OldPrice) || !string.IsNullOrWhiteSpace(Model.PriceWithDiscount))
                {
                    @*display "Price:" label if we have old price or discounted one*@
                    <label for="price-value-@(Model.ProductId)">@T("Products.Price"):</label>
                }
                @*render price*@
                <span @if (string.IsNullOrWhiteSpace(Model.PriceWithDiscount)) { <text> id="price-value-@(Model.ProductId)" class="price-value-@(Model.ProductId)" </text> }>
                    @Html.Raw(Model.Price)
                </span>
            </div>
            if (!string.IsNullOrWhiteSpace(Model.PriceWithDiscount))
            {
                @*discounted price*@
                <div class="product-price discounted-price">
                    <span>@T("Products.Price.WithDiscount"):</span>
                    <span class="price-value-@(Model.ProductId)">
                        @Html.Raw(Model.PriceWithDiscount)
                    </span>
                </div>
            }
            if (!string.IsNullOrEmpty(Model.BasePricePAngV))
            {
                <div class="base-price-pangv" id="base-price-pangv-@Model.ProductId">
                    @Model.BasePricePAngV
                </div>
            }
            if (Model.DisplayTaxShippingInfo)
            {
                var inclTax = await workContext.GetTaxDisplayTypeAsync() == TaxDisplayType.IncludingTax;
                //tax info is already included in the price (incl/excl tax). that's why we display only shipping info here
                //of course, you can modify appropriate locales to include VAT info there
                <div class="tax-shipping-info">
                    @T(inclTax ? "Products.Price.TaxShipping.InclTax" : "Products.Price.TaxShipping.ExclTax", await NopUrl.RouteTopicUrlAsync("shippinginfo"))
                </div>
            }
        }
    </div>
}
